package com.salesmanager.shop.product.entity.attribute;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.salesmanager.shop.commons.constants.SchemaConstant;
import com.salesmanager.shop.commons.model.description.Description;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.TableGenerator;
import javax.persistence.UniqueConstraint;

@Entity

@Table(name = "PRODUCT_OPTION_DESC",
        uniqueConstraints = {@UniqueConstraint(columnNames = {"PRODUCT_OPTION_ID", "LANGUAGE_ID"})}

)

@TableGenerator(name = "description_gen", table = "SM_SEQUENCER", pkColumnName = "SEQ_NAME", valueColumnName = "SEQ_COUNT",
        pkColumnValue = "product_option_description_seq", allocationSize = SchemaConstant.DESCRIPTION_ID_ALLOCATION_SIZE,
        initialValue = SchemaConstant.DESCRIPTION_ID_START_VALUE)
public class ProductOptionDescription extends Description {
    private static final long serialVersionUID = 1L;

    @JsonIgnore
    @ManyToOne(targetEntity = ProductOption.class)
    @JoinColumn(name = "PRODUCT_OPTION_ID", nullable = false)
    private ProductOption productOption;

    @Column(name = "PRODUCT_OPTION_COMMENT", length = 4000)
    private String productOptionComment;

    public ProductOptionDescription() {
    }

    public String getProductOptionComment() {
        return productOptionComment;
    }

    public void setProductOptionComment(String productOptionComment) {
        this.productOptionComment = productOptionComment;
    }

    public ProductOption getProductOption() {
        return productOption;
    }

    public void setProductOption(ProductOption productOption) {
        this.productOption = productOption;
    }
}
